<?php
	require_once("../config.php");
    $link = mysql_connect($host, $user, $pass);
    mysql_select_db($dbname);
    mysql_query("SET NAMES utf8");
    mysql_query("SET CHARACTER SET utf8");
	
	$clave = $_POST["clave"];
	$qry = "Select nombre, cantidad, confirmados From invitados Where clave = $clave";
	
	$r = mysql_query($qry);
	if(!$r){
		mysql_free_result($r);
		mysql_close($link);
		exit();
	}
    $rec = mysql_fetch_assoc($r);
    $ret = array(
		"name" => $rec['nombre'],
		"cantidad" => $rec['cantidad'],
		"confirm" => $rec['confirmados']
	);
	
	mysql_free_result($r);
	mysql_close($link);
	echo json_encode($ret);
?>
